import { TowerPassConditionPanel } from "../magicTower/TowerPassConditionPanel";
import { Cache } from "../../../cache/Cache";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { PloughCopyConfig } from "../../../resource/PloughCopyConfig";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { PloughCopyCache } from "../../../cache/PloughCopyCache";
type int = number;
//class PloughConditionPanel
    
    export  class PloughConditionPanel extends TowerPassConditionPanel
    {
        constructor()
        {
            super();
            return;
        }

        public updatePloughInfos(): void
        {
            this._ploughCache = Cache.instance.ploughCopy;
            _condition.htmlText = HTMLUtil.addColor(Language.getString(60360), "#FFFF00");
            _conditionLabel.htmlText = this.getCondition(this._ploughCache.curFloor);
            _remainBossLabel.htmlText = this.getRemainBoss(this._ploughCache.curFloor, this._ploughCache.totalBossNum, this._ploughCache.killBossNum);
            _expAward.htmlText = HTMLUtil.addColor(Language.getString(60361), "#FFFF00") + "\n";
            _expAwardText.htmlText = this.getAwardExp(this._ploughCache.curFloor);
            _useSec = this._ploughCache.useTime;
            _remainSec = this._ploughCache.leftTime;
            if (this._ploughCache.killBossNum < this._ploughCache.totalBossNum && (!_secTimer || !_secTimer.running)) 
            {
                updateTimeLabel();
                startTimer();
            }
            if (this._ploughCache.totalBossNum > 0 && this._ploughCache.killBossNum == this._ploughCache.totalBossNum) 
            {
                updateTimeLabel();
                stopTimer();
            }
            updatePosition();
            return;
        }

        /* internal  */getCondition(arg1: int): string
        {
            var loc1=PloughCopyConfig.instance.getPloughConditionByCode(arg1);
            loc1 = HTMLUtil.addColor(loc1, GlobalStyle.color1);
            return "<textFormat leading=\'5\'>" + loc1 + "</textFormat>";
        }

        /* internal  */getRemainBoss(arg1: int, arg2: int, arg3: int): string
        {
            var loc2=0;
            var loc1="";
            if (arg1 > 0) 
            {
                loc2 = (loc2 = arg2 - arg3) > 0 ? loc2 : 0;
                loc1 = HTMLUtil.addColor(Language.getString(60079), "#FFFF00") + HTMLUtil.addColor(loc2 + "/" + arg2, "#FE7E01");
            }
            return loc1;
        }

        /* internal  */getAwardExp(arg1: int): string
        {
            var loc1="";
            loc1 = loc1 + (Language.getString(60082) + PloughCopyConfig.instance.getPloughExpReward(arg1));
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, GlobalStyle.color1) + "</textFormat>";
        }

        /* internal */ /* var */_ploughCache: PloughCopyCache;
    }
